/** 协议常量定义 */
export const PROTOCOL = {
  COMMAND: {
    REQUEST: 0xf9,
    RESPONSE: 0xfa
  },
  OPERATION: {
    READ: 0x11,
    WRITE: 0x12,
    TERMINATE: 0x13,
    DATA_TRANSFER: 0x14,
    DATA_ACK: 0x18,
    GET_FLAG: 0x15,
    SET_FLAG: 0x16,
    HOST_AUTH: 0x20,
    DEVICE_AUTH: 0x21,
    CONFIG: 0x22
  },
  TYPE_LENGTH: 8
};

export enum Operation {
  READ = 'READ', //  11
  WRITE = 'WRITE', //  12 
  TERMINATE = 'TERMINATE', //  13
  DATA_TRANSFER = 'DATA_TRANSFER', //14
  DATA_ACK = 'DATA_ACK', // 18
  GET_FLAG = 'GET_FLAG', //  15
  SET_FLAG = 'SET_FLAG', //  16
  HOST_AUTH = 'HOST_AUTH', //  20
  DEVICE_AUTH = 'DEVICE_AUTH' // 21
}

/** 三模通用遥控器信息类型（严格符合标准文档定义） */
export enum RemoteControllerInfoType {
  HARDWARE = 'rel0', // 硬件信息
  FIRMWARE = 'fw01', // 固件信息
  VERSION = 'usr1', // 升级数据版本信息
  AUTH_CODE = 'usr2', // 认证识别码
  IR_TV = 'irtv', // 电视机红外遥控信息
  IR_STB = 'irstb', // 机顶盒红外遥控信息
  BLE_TV = 'bletv', // 电视机蓝牙/星闪遥控信息
  BLE_STB = 'blestb' // 机顶盒蓝牙/星闪遥控信息
}

/** 操作状态码 */
export enum OperationStatus {
  SUCCESS = 0x00,
  IN_PROGRESS = 0xf0,
  NOT_FOUND = 0xf2,
  FAILED = 0xff
}


/** 升级标志状态 */
export enum UpgradeFlag {
  NONE = 0x00000000,
  VALID = 0xf5f5f500
}

/** 认证状态码 */
export enum AuthStatus {
  INITIATE = 0x00,
  SUCCESS = 0x01,
  FAILED = 0x02
}

export enum CommandCode {
  SET_CONTROL_TARGET = 0x01,
  SET_TV_SOURCE_MODE = 0x02
}